function openTab(text,url,iconCls) {
    if($("#tabs").tabs("exists",text)){
        $("#tabs").tabs("select",text);
    }else{
        var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='" + url + "'></iframe>";
        $("#tabs").tabs("add",{
           title:text,
           iconCls:iconCls,
           closable:true,
           content:content
        });
    }
}

function logout() {
    $.messager.confirm("来自Cuixk","确定退出么？",function (r) {
        if(r){
            $.messager.alert("来自Cuixk","系统将于3秒后退出","info");
            toLogout(3000);
        }
    })
}
function toLogout(time) {
    setTimeout(function () {
        $.removeCookie("userIdStr");
        $.removeCookie("user");
        window.location.href="index";
    },time);
}

function openPasswordModifyDialog() {
    $("#dlg").dialog("open").dialog("setTitle","修改密码");
}

function closePasswordModifyDialog() {
    $("#dlg").dialog("close");
}

function modifyPassword() {
    $("#fm").form("submit",{
        url:ctx+"/user/updateUserPassword",
        onSubmit:function () {
            return $(this).form("validate");
        },
        success:function (data) {
            data=JSON.parse(data);
            if(data.code==200){
                $.messager.alert("来自cuixk","密码修改成功！","info");
                toLogout(3000);
                window.location.href="index";
            }else{
                alert(data.msg);
            }
        }
    })
}
